package com.jy.api.service.impl;import com.jy.api.service.SequenceService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.StringRedisTemplate;import org.springframework.data.redis.support.atomic.RedisAtomicLong;import org.springframework.stereotype.Component;import org.springframework.stereotype.Service;@Service@Component("sequenceService")public class SequenceServiceImpl implements SequenceService {    @Autowired    private StringRedisTemplate stringRedisTemplate;    public Long generate(String key) {        RedisAtomicLong counter = new RedisAtomicLong(key, stringRedisTemplate.getConnectionFactory());        counter.getAndAdd(1);        long x1 = counter.longValue();        return x1;    }}